package com.maopuyu.utils;

import com.maopuyu.entity.DistrictSchool;

import java.util.Date;
import java.util.Map;

public class WXReturnMsgUtils {

    public static String articleMsg(DistrictSchool districtSchool, String toUser, String fromUser) {
        return "<xml>\n" +
                "  <ToUserName><![CDATA[" + toUser + "]]></ToUserName>\n" +
                "  <FromUserName><![CDATA[" + fromUser + "]]></FromUserName>\n" +
                "  <CreateTime>" + new Date().getTime() + "</CreateTime>\n" +
                "  <MsgType><![CDATA[news]]></MsgType>\n" +
                "  <ArticleCount>1</ArticleCount>\n" +
                "  <Articles>\n" +
                "    <item>\n" +
                "      <Title><![CDATA[" + districtSchool.getTitle() + "]]></Title>\n" +
                "      <Description><![CDATA[" + districtSchool.getDescription() + "]]></Description>\n" +
                "      <PicUrl><![CDATA[" + districtSchool.getPicurl() + "]]></PicUrl>\n" +
                "      <Url><![CDATA[" + districtSchool.getUrl() + "]]></Url>\n" +
                "    </item>\n" +
                "  </Articles>\n" +
                "</xml>";
    }

    private String handleTextMsg(Map<String, String> map, String developer) {
        String recieveContent = map.get("Content");
        return "";
    }

    public static String handleMsg(Map<String, String> map, String developer) {
        //判断消息类型
        String msgType = map.get("MsgType");
        if (msgType.equals("text"))
            return handleMsg(map, developer);
        else
            return "";
    }
}
